﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebService.DAO;
using System.Data;
using WebService.VO;

namespace WebService.BUS
{
    public class DeviceBUS
    {
        DeviceDAO itemDeviceDAO;
        public DeviceBUS()
        {
            itemDeviceDAO = new DeviceDAO();
        }

        public DataTable getItemDeviceList()
        {
            return itemDeviceDAO.getItemDeviceList();
        }

        public bool insert(DeviceVO device)
        {
            if (!itemDeviceDAO.check(device.DeviceID))
            {
                itemDeviceDAO.insert(device);
                return true;
            }
            return false;
        }

        public void delete(string id)
        {
            itemDeviceDAO.delete(id);
        }

        public void update(DeviceVO device)
        {
            itemDeviceDAO.update(device);
        }

        public void insertHistory(DeviceHistoryVO deviceHistory)
        {
            itemDeviceDAO.insertHistory(deviceHistory);
        }

        public bool check(string name)
        {
            return itemDeviceDAO.check(name);
        }

        public DeviceVO getDevice(string id)
        {
            return itemDeviceDAO.getDevice(id);
        }

    }
}